//
//  NSString+Size.m
//  zhibay
//
//  Created by peter on 15/1/24.
//  Copyright (c) 2015年 union. All rights reserved.
//

#import "NSString+Size.h"

@implementation NSString (Size)
- (CGSize)parseSize:(UIFont*)myfont width:(float)width {
    CGSize tempSize = CGSizeMake(width, CGFLOAT_MAX);
    return [self holeParseTextSize:tempSize myfont:myfont];
}
- (CGSize)holeParseTextSize:(CGSize)size myfont:(UIFont *)myfont {
    CGRect sizet = [self boundingRectWithSize:size options:NSLineBreakByWordWrapping | NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:myfont forKey:NSFontAttributeName] context:nil];
    CGSize result = sizet.size;
    return result;
}
- (CGSize)parseSize:(UIFont*)myfont {
    
    CGSize tempSize =CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX);
    return [self holeParseTextSize:tempSize myfont:myfont];
}


@end
